using UnityEngine;

public class TriggerForAnim : MonoBehaviour
{
	public Transform TF_Parent;

	private Player SCRT_Player;

	private EnemySelecter SCRT_EnemySelecter;

	private string parentName;

	private void Awake()
	{
		parentName = TF_Parent.name;
		if (parentName.Contains("Player"))
		{
			parentName = "Player";
			SCRT_Player = TF_Parent.GetComponent<Player>();
		}
		else if (parentName.Contains("Enemy"))
		{
			parentName = "Enemy";
			SCRT_EnemySelecter = TF_Parent.GetComponent<EnemySelecter>();
		}
	}

	public void AttackZoneColOn(string swt)
	{
		string[] array = swt.Split(',');
		if (parentName == "Player")
		{
			if (array[0].Length > 0 && SCRT_Player.attackingNow)
			{
				SCRT_Player.SetAttackInfo(Player.instance.GetKindOfWeaponNumber(), (!Player.instance.at.GetCurrentAnimatorStateInfo(0).IsName("StickMan_SwipeAttack")) ? SCRT_Player.AttackPower() : (SCRT_Player.AttackPower() / 3), new Vector2((!(SCRT_Player.tf.localScale.x < 0f)) ? (-int.Parse(array[1])) : int.Parse(array[1]), int.Parse(array[2])));
				SCRT_Player.AttackZoneColOn(true, array[0]);
			}
			else
			{
				SCRT_Player.AttackZoneColOn(false);
			}
		}
		else if (parentName == "Enemy")
		{
			if (array[0].Length > 0 && SCRT_EnemySelecter.CheckAttackingNow())
			{
				SCRT_EnemySelecter.SetAttackInfo(SCRT_EnemySelecter.GetKindOfWeaponNumber(), SCRT_EnemySelecter.TotalAttackPower(), new Vector2((!(SCRT_EnemySelecter.transform.localScale.x < 0f)) ? (-int.Parse(array[1])) : int.Parse(array[1]), int.Parse(array[2])));
				SCRT_EnemySelecter.AttackZoneColOn(true, array[0]);
			}
			else
			{
				SCRT_EnemySelecter.AttackZoneColOn(false);
			}
		}
	}

	public void AttackingNowOFF()
	{
		if (parentName == "Player")
		{
			Player.instance.attackingNow = false;
		}
		else
		{
			SCRT_EnemySelecter.AttackingNowSwitch(false);
		}
	}

	public void ChangeCharacterGravity(int amount)
	{
		if (parentName == "Player")
		{
			SCRT_Player.rb.gravityScale = amount;
		}
		else if (parentName == "Enemy")
		{
			SCRT_EnemySelecter.ChangeGravityScale(amount);
		}
	}

	public void RunningSpeed()
	{
		if (parentName == "Player")
		{
			SCRT_Player.rb.velocity = new Vector2((!(SCRT_Player.tf.localScale.x < 0f)) ? (-SCRT_Player.runningSpeed) : SCRT_Player.runningSpeed, SCRT_Player.rb.velocity.y);
		}
		else if (parentName == "Enemy")
		{
			SCRT_EnemySelecter.RunningSpeed();
		}
	}

	public void StopVelocity()
	{
		if (parentName == "Player")
		{
			SCRT_Player.rb.velocity = Vector2.zero;
		}
		else if (parentName == "Enemy")
		{
			SCRT_EnemySelecter.VelocityZero();
		}
	}

	public void ChangeVelocityForSwipeAttack()
	{
		if (parentName == "Player")
		{
			SCRT_Player.rb.velocity = SCRT_Player.velocityForSwipeAttack;
		}
	}

	public void DashMotion()
	{
		if (parentName == "Player")
		{
			SCRT_Player.at.Play(SCRT_Player.dash_NormalList[0], -1, 0f);
		}
		else if (parentName == "Enemy")
		{
			SCRT_EnemySelecter.DashMotion();
		}
	}

	public void Throwing(int kind)
	{
		if (parentName == "Player")
		{
			SCRT_Player.Throwing(kind);
		}
		else if (parentName == "Enemy")
		{
			SCRT_EnemySelecter.Throwing(kind);
		}
	}

	public void BodyTrailSwtich(float width)
	{
		if (parentName == "Player")
		{
			SCRT_Player.BodyTrailSwtich(width);
		}
		else if (parentName == "Enemy")
		{
			SCRT_EnemySelecter.BodyTrailSwtich(width);
		}
	}

	public void ChangeWeaponTrailShowingTime(float time)
	{
		if (parentName == "Player")
		{
			SCRT_Player.ChangeWeaponTrailShowingTime(time);
		}
		else if (parentName == "Enemy")
		{
			SCRT_EnemySelecter.ChangeWeaponTrailShowingTime(time);
		}
	}

	public void ShootArrow1()
	{
		if (parentName == "Player")
		{
			SCRT_Player.ShootArrow1();
		}
		else if (parentName == "Enemy")
		{
			SCRT_EnemySelecter.ShootArrow1();
		}
	}

	public void ShootHommingMagic1()
	{
		if (!(parentName == "Player") && parentName == "Enemy")
		{
			SCRT_EnemySelecter.ShootHommingMagic1();
		}
	}

	public void PlaySound(int num)
	{
		Audio.instance.sfx[num].Play();
	}
}
